package com.example.demo.proxy;

import org.springframework.cglib.proxy.Enhancer;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class ProxyTest {

    public static void main(String[] args){

        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(Employee.class);

        MethodInterceptor interceptor = new MethodInterceptor() {

            @Override
            public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
                System.out.println("原方法名是:"+method.getName());
                System.out.println("原方法声名类为:"+method.getDeclaringClass());

                return null;
            }
        };

    }
}
